//
//  EmojiPageVC.m
//  oschina_song
//
//  Created by song on 16/2/15.
//  Copyright © 2016年 song. All rights reserved.
//

#import "EmojiPageVC.h"
#import "EmojiPanelVC.h"
#import "UIColor+utils.h"

@interface EmojiPageVC ()<UIPageViewControllerDataSource>

@end


@implementation EmojiPageVC


-(id)initWithTextView:(PlaceholderTextView *)textview
{
    self = [super initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
    
    return self;
}

-(void)viewDidLoad
{
    [super viewDidLoad];
//    self.view.backgroundColor = [UIColor themeColor];
    EmojiPanelVC *emojiPanelVC =[[EmojiPanelVC alloc] initWithPageIndex:0];
    if(emojiPanelVC != nil)
    {
        self.dataSource  = self;
        [self setViewControllers:@[emojiPanelVC] direction:UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];
    }
}

-(UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(EmojiPanelVC *)pvc
{
    int index =pvc.pageIndex;
    if (index == 0) {
        return  nil;
    }else{
        NSLog(@"index-1 = %d",index -1 );
        EmojiPanelVC *emojiPanelVC = [[EmojiPanelVC alloc] initWithPageIndex:index-1];
        return  emojiPanelVC;
    }

}

-(UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(EmojiPanelVC *)pvc
{
    int index =pvc.pageIndex;
    
    if(index == 6)
    {
        return nil;
    }else{
        NSLog(@"index+1 = %d",index +1 );
        EmojiPanelVC *emojiPanelVC = [[EmojiPanelVC alloc] initWithPageIndex:index+1];
        return  emojiPanelVC;
    }

}

-(NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
{
    return 7;
}

-(NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
{
    return 0;
}


@end
